package rmi;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
/**
 * Ein einfacher RMI-Client nach dem Oracle Java-Tutorial {@link <a href="http://download.oracle.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html">RMI-Tutorial</a>}
 * @author Bernd Kahlbrandt
 *
 */
public class Client {
    private Client() {}
/**
 * 
 * @param args Host des Servers.
 */
    public static void main(String[] args) {

        String host = (args.length < 1) ? null : args[0];
        try {
            Registry registry = LocateRegistry.getRegistry(host);
            IAnswer stub = (IAnswer) registry.lookup("Answer");
            String response = stub.answer();
            System.out.println("Antwort von Server: " + response);
        } catch (Exception e) {
            System.err.println("Client exception: " + e.toString());
            e.printStackTrace();
        }
    }

}
